﻿namespace Whut.ObjectSharePointMapper.Internals
{
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    public class ListInfo
    {
        private Dictionary<Guid, FieldInfo> fields;

        public ListInfo(string listRelativeUrl)
        {
            this.ListRelativeUrl = listRelativeUrl;
            this.fields = new Dictionary<Guid, FieldInfo>();
        }

        /// <summary>
        /// List relative url.
        /// </summary>
        public string ListRelativeUrl { get; private set; }

        public FieldInfo Id { get; set; }

        public IEnumerable<FieldInfo> Fields
        {
            get
            {
                return this.fields.Values;
            }
        }

        public void AddFieldInfo(Guid fieldId, PropertyInfo propertyInfo)
        {
            this.fields.Add(fieldId, new FieldInfo(fieldId, propertyInfo));
        }
    }
}
